<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style type="text/css">
        .abc{
            background-color:red;
        }
        .xyz{
            background-color:green;
        }
    </style>
</head>
<body>
<div id="app">
    <div :class="{abc:isred,xyz:!isred}">我是一个div</div>
    <button @click="isred=true">变红</button>
    <button @click="isred=false">变绿</button>
</div>

<!--引入vue文件-->
<script type="text/javascript" src="js/vue-2.6.12.js"></script>
<script>
    const v=new Vue({
        el:"#app",
        data:{
            isred:true
        }
    });

</script>
</body>
</html>